package module.edittroop
{
	import com.darwin.darwinDll.Dll;
	
	import module.edittroop.model.dataObj.ArmsConfigObj;
	import module.edittroop.model.dataObj.HeroConfigObj;
	import module.edittroop.model.dataObj.SkillConfigObj;
	/**
	 *编组部队配置信息（英雄信息，技能信息，士兵信息） 
	 * @author jichang
	 * 
	 */
	public class EditTroopConfig
	{
		public function EditTroopConfig()
		{
			
		}
		/**
		 *获取士兵信息配置 
		 * @return 
		 * 
		 */		
		public static function get prestigeConfigArr():Array{
			return Dll.getInstance().getSynPreloadRes("arms") as Array;
		}
		public static function get heroConfig():Array{
			return Dll.getInstance().getSynPreloadRes("hero") as Array;
		}
		/**
		 *
		 */		
		private static var _heroConfigArr:Array;
		public static function get heroConfigArr():Array{
			if(!_heroConfigArr){
				_heroConfigArr = [];
				var len:int = heroConfig.length;
				for(var i:int=0;i<len;i++){
					_heroConfigArr.push(HeroConfigObj.praseData(heroConfig[i]));
				}
			}
			return _heroConfigArr;
	}
		private static var _armsConfigArr:Array;
		public static function get armsConfigArr():Array
		{
			if(!_armsConfigArr)
			{
				_armsConfigArr = [];
				var len:int = prestigeConfigArr.length;
				for(var j:int = 0;j<len;j++)
				{
					_armsConfigArr.push(ArmsConfigObj.praseData(prestigeConfigArr[j]));
				}
			}
			return _armsConfigArr;
		}
		/**
		 *通过skillList数值得到技能 名字
		 * @param skill
		 * @return 
		 * 
		 */		
		public static function getSkillFromSkillList(skill:uint):SkillConfigObj
		{
			var $arr:Array = Dll.getInstance().getSynPreloadRes("skill") as Array;
			var $skillObj:SkillConfigObj = new SkillConfigObj();
			for(var i:uint;i<$arr.length;i++)
			{
				if($arr[i].id== skill)
				{
					$skillObj = SkillConfigObj.praseData($arr[i]);
					return $skillObj;
					break;
				}
			}
			return null;
		}
	}
}